//
//  GQCityFriendCell.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/22.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQCityFriendCell.h"

@interface GQCityFriendCell()

@property (strong, nonatomic) UIButton *selectedBtn;

@end

@implementation GQCityFriendCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpChildView];
    }
    return self;
}

- (void)setUpChildView
{
    
    CGFloat iconBtnH = 40;
    CGFloat detailLabelH = 15;
    CGFloat addVWidth = 15;
    CGFloat attentionBtnW = 60;
    CGFloat height = 60;
    
    //设置icon
    UIButton *iconBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, height / 2 - iconBtnH / 2, iconBtnH, iconBtnH)];
    [iconBtn setImage:[UIImage imageWithRoundName:@"icon"] forState:UIControlStateNormal];
    [self addSubview:iconBtn];
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"relationship_famous_accreditation"]];
    imageView.x = iconBtn.width - addVWidth;
    imageView.y = iconBtn.height - addVWidth;
    imageView.width = addVWidth;
    imageView.height = addVWidth;
    [iconBtn addSubview:imageView];
    
    UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(iconBtn.frame) + 10, iconBtn.y + 10, 150, 15)];
    nameLabel.text = @"周星驰";
    nameLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:nameLabel];
    
    UILabel *titLabel = [[UILabel alloc] init];
    titLabel.frame = CGRectMake(nameLabel.x, CGRectGetMaxY(iconBtn.frame) - detailLabelH, 150, detailLabelH);
    titLabel.text = @"中国书画协会名誉会长";
    titLabel.font = [UIFont systemFontOfSize:10];
    [self addSubview:titLabel];
    
    UIButton *attentionBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - 10 - attentionBtnW, height / 2 - 25 / 2, attentionBtnW, 25)];
    attentionBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    [attentionBtn setImage:[UIImage imageNamed:@"relationship_concern"] forState:UIControlStateNormal];
    [attentionBtn setImage:[UIImage imageNamed:@"relationship_concerned"] forState:UIControlStateSelected];
    [attentionBtn addTarget:self action:@selector(attentionBtnDidClick:) forControlEvents:UIControlEventTouchUpInside];
    [attentionBtn setTitle:@"关注" forState:UIControlStateNormal];
    [self addSubview:attentionBtn];
    
}

- (void)attentionBtnDidClick:(UIButton *)btn
{
    btn.selected = !btn.selected;
}

@end
